home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / RCS / ndbm.h,v < prev    next >
Encoding:
Text File  |  1989-06-23  |  2.2 KB  |  123 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.3
  10. date     89.06.23.11.30.36;  author rab;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     88.06.29.14.58.03;  author ouster;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     88.06.26.15.22.23;  author ouster;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @@
  27.  
  28.  
  29. 1.3
  30. log
  31. @*** empty log message ***
  32. @
  33. text
  34. @/*
  35.  * Copyright (c) 1983 Regents of the University of California.
  36.  * All rights reserved.  The Berkeley software License Agreement
  37.  * specifies the terms and conditions for redistribution.
  38.  *
  39.  *    @@(#)ndbm.h    5.1 (Berkeley) 5/30/85
  40.  */
  41.  
  42. #ifndef _NDBM
  43. #define _NDBM
  44.  
  45. /*
  46.  * Hashed key data base library.
  47.  */
  48. #define PBLKSIZ 1024
  49. #define DBLKSIZ 4096
  50.  
  51. typedef struct {
  52.     int    dbm_dirf;        /* open directory file */
  53.     int    dbm_pagf;        /* open page file */
  54.     int    dbm_flags;        /* flags, see below */
  55.     long    dbm_maxbno;        /* last ``bit'' in dir file */
  56.     long    dbm_bitno;        /* current bit number */
  57.     long    dbm_hmask;        /* hash mask */
  58.     long    dbm_blkptr;        /* current block for dbm_nextkey */
  59.     int    dbm_keyptr;        /* current key for dbm_nextkey */
  60.     long    dbm_blkno;        /* current page to read/write */
  61.     long    dbm_pagbno;        /* current page in pagbuf */
  62.     char    dbm_pagbuf[PBLKSIZ];    /* page file block buffer */
  63.     long    dbm_dirbno;        /* current block in dirbuf */
  64.     char    dbm_dirbuf[DBLKSIZ];    /* directory file block buffer */
  65. } DBM;
  66.  
  67. #define _DBM_RDONLY    0x1    /* data base open read-only */
  68. #define _DBM_IOERR    0x2    /* data base I/O error */
  69.  
  70. #define dbm_rdonly(db)    ((db)->dbm_flags & _DBM_RDONLY)
  71.  
  72. #define dbm_error(db)    ((db)->dbm_flags & _DBM_IOERR)
  73.     /* use this one at your own risk! */
  74. #define dbm_clearerr(db)    ((db)->dbm_flags &= ~_DBM_IOERR)
  75.  
  76. /* for flock(2) and fstat(2) */
  77. #define dbm_dirfno(db)    ((db)->dbm_dirf)
  78. #define dbm_pagfno(db)    ((db)->dbm_pagf)
  79.  
  80. typedef struct {
  81.     char    *dptr;
  82.     int    dsize;
  83. } datum;
  84.  
  85. /*
  86.  * flags to dbm_store()
  87.  */
  88. #define DBM_INSERT    0
  89. #define DBM_REPLACE    1
  90.  
  91. DBM    *dbm_open();
  92. void    dbm_close();
  93. datum    dbm_fetch();
  94. datum    dbm_firstkey();
  95. datum    dbm_nextkey();
  96. long    dbm_forder();
  97. int    dbm_delete();
  98. int    dbm_store();
  99.  
  100. #endif /* _NDBM */
  101. @
  102.  
  103.  
  104. 1.2
  105. log
  106. @Add ifdefs so that file can't be processed twice.
  107. @
  108. text
  109. @d67 1
  110. a67 1
  111. #endif _NDBM
  112. @
  113.  
  114.  
  115. 1.1
  116. log
  117. @Initial revision
  118. @
  119. text
  120. @d9 3
  121. d66 2
  122. @
  123.